local yizhong = fk.CreateSkill {
  name = "ls__yizhong",
}

Fk:loadTranslationTable{
  ["ls__yizhong"] = "毅重",
  [":ls__yizhong"] = "当黑色【杀】对己方角色生效前，若其手牌数不大于你，你可明置一张手牌，令此【杀】对其无效。",
  ["#ls__yizhong"] = "你可明置一张手牌令此【杀】对%src无效",

  ["$ls__yizhong1"] = "杀我？你做不到。",
  ["$ls__yizhong2"] = "不动如泰山！",
}

local ls = require "packages/lvshi/utility"
local TT = require "packages/tuntian_studio/utility"
local DIY = require "packages/diy_utility/diy_utility"

yizhong:addEffect(fk.PreCardEffect, {
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(yizhong.name) and ls.isFriend(player, data.to) and
    data.to:getHandcardNum() <= player:getHandcardNum() and data.card.trueName == "slash" and data.card.color == Card.Black
  end,
  on_cost = function(self, event, target, player, data)
    local room = player.room
    local ids = table.filter(player:getCardIds("h"), function (id)
      return not TT.isShown(id)
    end)
    local cards = room:askToCards(player, {
      min_num = 1,
      max_num = 1,
      skill_name = yizhong.name,
      pattern = tostring(Exppattern{ id = ids}),
      prompt = "#ls__yizhong:"..data.to.id,
      cancelable = true,
    })
    if #cards > 0 then
      event:setCostData(self, {cards = cards})
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    DIY.showCards(player, event:getCostData(self).cards)
    data.nullified = true
  end
})

return yizhong